package com.codrim.cs.data.server.dao.param;

import com.codrim.cs.data.rpc.dto.param.OfferDataParamDTO;
import com.codrim.cs.data.server.utils.DateUtils;

import java.io.Serializable;
import java.util.List;

import lombok.Data;

/**
 * Created by Liang.Zhuge on 17/08/2017.
 */
@Data
public class OfferDataParam implements Serializable {
    private String startDay;
    private String endDay;
    private List<Integer> offerIds;
    private Integer companyId;

    public static OfferDataParam of(OfferDataParamDTO dto) {
        OfferDataParam result = new OfferDataParam();

        result.companyId = dto.getCompanyId();
        result.startDay = DateUtils.toUTCString(dto.getStartDay(), "yyyyMMdd");
        result.endDay = DateUtils.toUTCString(dto.getEndDay(), "yyyyMMdd");
        result.offerIds = dto.getOfferIds();

        return result;
    }
}
